package galaxies.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/*
 * Defines number of tiles per star in a galaxy.
 * 
 * Values read in via external XML file.
 */

public class GalaxyDensity {

	private HashMap<String, Integer> galaxyDensity = new HashMap<String, Integer>();
	private ArrayList<String> entries = new ArrayList<String>();
	
	public ArrayList<String> getEntries() {
		return this.entries;
	}
	
	public void addDensity(String ref, Integer tilesPerStar) {
		galaxyDensity.put(ref, tilesPerStar);
		entries.add(ref);
	}
	
	public int getDensity(String ref) {
		return galaxyDensity.get(ref);
	}
	
	public HashMap<String, Integer> getGalaxyDensities() {
		return this.galaxyDensity;
	}
	
	public void setDensity(HashMap<String, Integer> galaxyDensities) {
		this.galaxyDensity.clear();
		this.galaxyDensity.putAll(galaxyDensities);
		
		for (Map.Entry<String, Integer> entry : galaxyDensity.entrySet()) {
			entries.add(entry.getKey());
		}
	}
	
}
